add item to tuple python

35

a = ('2',)
b = 'z'
new = (*a, b)
>>> T1=(10,50,20,9,40,25,60,30,1,56)
>>> L1=list(T1)
>>> L1
[10, 50, 20, 9, 40, 25, 60, 30, 1, 56]
>>> L1.append(100)
>>> T1=tuple(L1)
>>> T1
(10, 50, 20, 9, 40, 25, 60, 30, 1, 56, 100)
a = ('2',)
b = 'z'
new = a + (b,)

a = ('2',)
b = 'z'
new = a + (b,)

Comments

Submit
0 Comments